package cn.gson.springboot.model.pojos;

import javax.persistence.*;
import java.math.BigDecimal;
import java.sql.Date;
import java.util.Objects;

@Entity
@Table(name = "payment_records", schema = "crm")
public class PaymentRecords {
    private int paymentRecordsId;
    private Integer paymentRecordsPeriods;
    private Date paymentRecordsDate;
    private BigDecimal paymentRecordsAmount;
    private Integer paymentRecordsPayStyle;
    private Integer paymentRecordsWhetherTicket;
    private Integer paymentRecordsClassify;
    private String paymentRecordsNote;
    private Customer customerByCustomerId;// 供应商
    private Employee employeeByEmpId;
    private Purchase purchaseByPurchaseId;
    private PaymentPlan paymentPlanByPaymentPlanId;
    private Return returnByReturnId;

    @Id
    @Column(name = "payment_records_id", nullable = false)
    public int getPaymentRecordsId() {
        return paymentRecordsId;
    }

    public void setPaymentRecordsId(int paymentRecordsId) {
        this.paymentRecordsId = paymentRecordsId;
    }


    @Basic
    @Column(name = "payment_records_periods", nullable = true)
    public Integer getPaymentRecordsPeriods() {
        return paymentRecordsPeriods;
    }

    public void setPaymentRecordsPeriods(Integer paymentRecordsPeriods) {
        this.paymentRecordsPeriods = paymentRecordsPeriods;
    }

    @Basic
    @Column(name = "payment_records_date", nullable = true)
    public Date getPaymentRecordsDate() {
        return paymentRecordsDate;
    }

    public void setPaymentRecordsDate(Date paymentRecordsDate) {
        this.paymentRecordsDate = paymentRecordsDate;
    }

    @Basic
    @Column(name = "payment_records_amount", nullable = true, precision = 2)
    public BigDecimal getPaymentRecordsAmount() {
        return paymentRecordsAmount;
    }

    public void setPaymentRecordsAmount(BigDecimal paymentRecordsAmount) {
        this.paymentRecordsAmount = paymentRecordsAmount;
    }

    @Basic
    @Column(name = "payment_records_pay_style", nullable = true)
    public Integer getPaymentRecordsPayStyle() {
        return paymentRecordsPayStyle;
    }

    public void setPaymentRecordsPayStyle(Integer paymentRecordsPayStyle) {
        this.paymentRecordsPayStyle = paymentRecordsPayStyle;
    }

    @Basic
    @Column(name = "payment_records_whether_ticket", nullable = true)
    public Integer getPaymentRecordsWhetherTicket() {
        return paymentRecordsWhetherTicket;
    }

    public void setPaymentRecordsWhetherTicket(Integer paymentRecordsWhetherTicket) {
        this.paymentRecordsWhetherTicket = paymentRecordsWhetherTicket;
    }

    @Basic
    @Column(name = "payment_records_classify", nullable = true)
    public Integer getPaymentRecordsClassify() {
        return paymentRecordsClassify;
    }

    public void setPaymentRecordsClassify(Integer paymentRecordsClassify) {
        this.paymentRecordsClassify = paymentRecordsClassify;
    }

    @Basic
    @Column(name = "payment_records_note", nullable = true, length = 255)
    public String getPaymentRecordsNote() {
        return paymentRecordsNote;
    }

    public void setPaymentRecordsNote(String paymentRecordsNote) {
        this.paymentRecordsNote = paymentRecordsNote;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        PaymentRecords that = (PaymentRecords) o;
        return paymentRecordsId == that.paymentRecordsId &&
                Objects.equals(paymentRecordsDate, that.paymentRecordsDate) &&
                Objects.equals(paymentRecordsPayStyle, that.paymentRecordsPayStyle) &&
                Objects.equals(paymentRecordsAmount, that.paymentRecordsAmount) &&
                Objects.equals(paymentRecordsNote, that.paymentRecordsNote) &&
                Objects.equals(paymentRecordsWhetherTicket, that.paymentRecordsWhetherTicket) &&
                Objects.equals(paymentRecordsClassify, that.paymentRecordsClassify);
    }

    @Override
    public int hashCode() {
        return Objects.hash(paymentRecordsId, paymentRecordsDate, paymentRecordsPayStyle, paymentRecordsAmount, paymentRecordsNote, paymentRecordsWhetherTicket);
    }

    @ManyToOne
    @JoinColumn(name = "purchase_id", referencedColumnName = "purchase_id")
    public Purchase getPurchaseByPurchaseId() {
        return purchaseByPurchaseId;
    }

    public void setPurchaseByPurchaseId(Purchase purchaseByPurchaseId) {
        this.purchaseByPurchaseId = purchaseByPurchaseId;
    }

    @ManyToOne
    @JoinColumn(name = "customer_id", referencedColumnName = "customer_id")
    public Customer getCustomerByCustomerId() {
        return customerByCustomerId;
    }

    public void setCustomerByCustomerId(Customer customerByCustomerId) {
        this.customerByCustomerId = customerByCustomerId;
    }

    @ManyToOne
    @JoinColumn(name = "emp_id", referencedColumnName = "emp_id")
    public Employee getEmployeeByEmpId() {
        return employeeByEmpId;
    }

    public void setEmployeeByEmpId(Employee employeeByEmpId) {
        this.employeeByEmpId = employeeByEmpId;
    }

    @ManyToOne
    @JoinColumn(name = "payment_plan_id", referencedColumnName = "payment_plan_id")
    public PaymentPlan getPaymentPlanByPaymentPlanId() {
        return paymentPlanByPaymentPlanId;
    }

    public void setPaymentPlanByPaymentPlanId(PaymentPlan paymentPlanByPaymentPlanId) {
        this.paymentPlanByPaymentPlanId = paymentPlanByPaymentPlanId;
    }

    @ManyToOne
    @JoinColumn(name = "return_id", referencedColumnName = "return_id")
    public Return getReturnByReturnId() {
        return returnByReturnId;
    }

    public void setReturnByReturnId(Return returnByReturnId) {
        this.returnByReturnId = returnByReturnId;
    }

}
